<template>
  <div class="NavBar">
    <van-nav-bar
      :fixed="isFixed"
      :placeholder="isFixed"
      custom-class="custom-nav-bar"
      :title="title"
      @click-left="goBack"
    >
      <template #left>
        <van-icon v-if="lefticon" name="arrow-left" size="25" color="#FFFFFF" />
      </template>
    </van-nav-bar>
  </div>
</template>

<script>
// @ is an alias to /src
export default {
  name: "NavBar",
  props: {
    title: {
      type: String,
      required: true
      //必须传递
    },
    lefticon: {
      type: Boolean,
      default: true
      //默认值
    },
    isFixed: {
      type: Boolean,
      default: false
      //默认值
    }
  },
  data() {
    return {};
  },
  methods: {
    goBack() {
      this.$router.go(-1); // 返回上一页
    }
  }
};
</script>
<style lang="less" scoped>
.fixed {
  position: fixed;
  top: 0;
  left: 0;
}
/deep/.van-nav-bar {
  background-color: var(--color-zhuti);
  color: var(--color-font) !important;
}
/deep/.van-nav-bar__title {
  color: var(--color-font) !important;
}
/deep/.van-hairline--bottom:after {
  border-bottom-width: 0;
}
/deep/.van-nav-bar__content {
  height: 60px !important;
}
</style>
